home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-22 | 2.4 KB | 58 lines | [TEXT/X_#a] |
- ; Tutorial 8: 3D Transformations
-
- animate 60
-
- ; Transformations in 3D are only a little more complicated
- ; than 2D transformations. (Visualizing their use is
- ; a lot more difficult for most people, though.) First of
- ; all, there is nothing in xModels-3D corresponding to "xskew",
- ; "yskew", or "rotate ... about ...". Scaling, rotation, and
- ; translation all have their place, however.
- ;
- ; Scaling can take three parameters, giving scale factors in
- ; the x, y, and z directions respectively. For example,
- ; "cube scale 2,4,6" makes a 2-by-4-by-6 "brick". As you
- ; might expect, "scale 3" is short for "scale 3,3,3", and,
- ; not so obviously, "scale 3,7" is short for "scale 3,7,7".
- ; There are also separate "xscale", "yscale", and "zscale"
- ; commands.
- ;
- ; The "translate" transformation takes three parameters
- ; which give displacements in the x, y, and z directions
- ; repsectively. You can also use "xtranslate", "ytranslate",
- ; and "ztranslate" with one parameter. Note that
- ; "ztranslate -5" moves an object away from you while
- ; "ztranslate 5" moves an object towards you.
- ;
- ; There are three different rotation transformations:
- ;
- ; 1) "xrotate" specifies a rotation about the x-axis:
-
- square scale 4
- ztranslate 7 ; Move the square towards you
- xrotate 0:360 ; Square rotates around the x-axis,
- ; moving up and away from you then
- ; down and back. The center of the
- ; square moves along a circle in
- ; the yz-plane
-
- ; 2) "yrotate" specifies a rotation about the y-axis
-
- circle scale 4
- ztranslate 7 ; Move the circle towards you
- yrotate 0:360 ; Circle rotates around the y-axis,
- ; moving right and away from you then
- ; left and back. The center of the
- ; circle moves along a circle in
- ; the xz-plane.
-
- ; 3) "zrotate" specifies a rotation about the z-axis. This is
- ; similar to rotation in 2D about the origin, and in fact
- ; you can use "rotate" as a synonym for "zrotate"
- ; See the previous tutorial for an example.
- ;
- ; It is not necessarily easy to use these rotations to position
- ; an object in just the right position and orientation. It
- ; will probably require some practice and some analysis of
- ; examples.
-